<?php

/**
 * Maikuro Framework
 *
 * LICENSE:
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * The license is bundled with this package in the file LICENSE.txt.
 * You may also obtain a copy of the License at this URL:
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @copyright  Copyright (c) 2010, Jonathan Hedrén
 * @author     Jonathan Hedrén <jonathan.hedren@gmail.com>
 * @license    http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */

/**
 * @see AbstractHTMLElement
 */
require_once 'AbstractHTMLElement.php';

class HTMLInputElement extends AbstractHTMLElement
{
    /**
     * The types of files that can be submitted through a file upload
     * (only for type="file").
     *
     * @var string
     */
    public $accept;

    /**
     * The alternate text for an image input (only for type="image").
     *
     * @var string
     */
    public $alt;

    /**
     * Indicates whether an input element should be pre-selected or not
     * (only for type="checkbox" or type="radio").
     *
     * @var string
     */
    public $checked;

    /**
     * Indicates whether an input element should be disabled or not.
     *
     * @var string
     */
    public $disabled;

    /**
     * The maximum length (in characters) of an input field
     * (only for type="text" or type="password").
     *
     * @var integer
     */
    public $maxLength;

    /**
     * The name of an input element.
     *
     * @var string
     */
    public $name;

    /**
     * Indicates whether an input field should be read-only or not
     * (only for type="text" or type="password").
     *
     * @var boolean
     */
    public $readonly;

    /**
     * The width of an input field.
     *
     * @var integer
     */
    public $size;

    /**
     * The URL to an image to display as a submit button
     * (only for type="image").
     *
     * @var string
     */
    public $src;

    /**
     * The input type.
     *
     * @var string
     */
    public $type;

    /**
     * The value of the input field.
     *
     * @var string
     */
    public $value;

    public function toString()
    {
        return '<input' . $this->getFormattedAttributes() . ' />' . self::NEWLINE;
    }
}